<?php

class Settings
{
	static public function get($code)
	{
		static $q = null;
		createStaticQuery($q,"
			SELECT value
			FROM cf_settings
			WHERE code=:code
		");
		$q->setParam('code',$code);
		$q->execute();
		if (!$q->fetch()) {
			throw new Exception("Invalid settings parameter with code [$code]");
		}
		$v = $q->at(0);
		$q->close();
		return $v;
	}
	
	public function __get($code) 
	{
		return self::get($code);
	}
}

$settings = new Settings;

?>